#! /bin/sh
# Shell: Unisam2 
# Example: unisam2 --- uniform sampling in 2 dimensions
# Author: John Stockwell, 27 August 1992

#set -x

# constant wavespeed (of 10) model  100x100 samples

echo "10" > junkv              # make ascii data

a2b < junkv n1=1 > infile.v    # convert to binary	
unisam2 < infile.v x1=0 n1=100 d1=1 x2=0 n2=100 d2=1 f2=0 > outfile.v 

#psimage < outfile.v n1=100 n2=100 title="Constant wavespeed"  \
#       label1="x1 direction" label2="x2 direction" | open 

#ximage < outfile.v n1=100 n2=100 title="Constant wavespeed"  \
#       label1="x1 direction" label2="x2 direction"


# imagine data taken in two wells with positions on the surface given
# by the x2 postions 0 and 100
well1="10 10 20 20"   # array of ascii data
well2="10 10 20 20"

rm junkv

# echo all the values as a single column of data in junkv
for i in $well1 $well2 
do
	echo $i  >> junkv
done

a2b < junkv n1=1 > infile.v
unisam2 < infile.v x1=0,49,50,100 n1=100 d1=1 \
		x2=0,100 n2=100 d2=1 f2=0 |
#psimage n1=100 n2=100 title="2 Layer model" \
#       label1="x1 direction" label2="x2 direction" | open 

#ximage n1=100 n2=100 title="2 Layer model" \
#       label1="x1 direction" label2="x2 direction"

# more complicated model --- 3 wells 
well1="10 10 20 20"
well2="10 20 20 20"
well3="10 10 20 20"

rm junkv

# echo all the values as a single column of data in junkv
for i in $well1 $well2 $well3
do
	echo $i  >> junkv
done

a2b < junkv n1=1 > infile.v
unisam2 < infile.v x1=0,25,50,100 n1=100 d1=1 \
		x2=0,50,100 n2=100 d2=1 f2=0 |

#psimage n1=100 n2=100 title="3 well 2 Layer model" \
#       label1="x1 direction" label2="x2 direction" | open 

#ximage n1=100 n2=100 title="3 well 2 Layer model" \
#       label1="x1 direction" label2="x2 direction" 

# more complicated model --- 6 wells  -- 6 data values per well
well1="10 10 20 20 30 30"
well2="10 20 20 20 30 30"
well3="10 10 20 20 30 30"
well4="10 20 40 10 10 30"
well5="10 10 10 20 30 30" 
well6="10 10 20 20 30 30"

rm junkv

# echo all the values as a single column of data in junkv
for i in $well1 $well2 $well3 $well4 $well5 $well6
do
	echo $i  >> junkv
done

a2b < junkv n1=1 > infile.v
unisam2 < infile.v x1=0,10,25,50,75,100 n1=100 d1=1 \
		x2=0,20,30,50,75,100 n2=100 d2=1 f2=0 |

#psimage n1=100 n2=100 title="6 well 6 Layer model" \
#       label1="x1 direction" label2="x2 direction" | open 

#ximage n1=100 n2=100 title="6 well 6 Layer model" \
#       label1="x1 direction" label2="x2 direction" 

unisam2 < infile.v x1=0,10,25,50,75,100 n1=100 d1=1  method=akima\
		x2=0,20,30,50,75,100 n2=100 d2=1 f2=0 |

#psimage n1=100 n2=100 title="6x6 model Akima" \
#        label1="x1 direction" label2="x2 direction" | open 

#psimage n1=100 n2=100 title="6x6 model Akima" \
#        label1="x1 direction" label2="x2 direction" 
